package com.yboot.module.system.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.yboot.module.system.mapper.SysUserMapper;
import com.yboot.module.system.model.dto.SysUserDto;
import com.yboot.module.system.model.entity.SysUserEntity;
import com.yboot.module.system.model.query.SysUserQuery;
import com.yboot.module.system.model.vo.SysUserDetailVo;
import com.yboot.module.system.model.vo.SysUserVo;
import com.yboot.module.system.service.ISysUserService;
import com.yboot.starter.mybatis.core.base.service.BaseServiceImpl;
import org.springframework.stereotype.Service;

/**
 * 用户表
 * @author yangcs
 * @date 2025-08-29
 */
@Service
public class SysUserServiceImpl extends BaseServiceImpl<SysUserMapper, SysUserEntity, SysUserVo, SysUserDetailVo, SysUserQuery, SysUserDto> implements ISysUserService {

    @Override
    public SysUserVo getByUsername(String username) {
        SysUserEntity sysUserEntity = getOne(Wrappers.<SysUserEntity>lambdaQuery().eq(SysUserEntity::getUsername, username));
        return BeanUtil.copyProperties(sysUserEntity, SysUserVo.class);
    }
}
